//使用此模块进行同意管理
import request from "./request";
import mokeserve from "./mokerequest"
//三级联动的接口 http://39.98.123.211/api/product/getBaseCategoryList


//返回的结果是promise对象
export const reqCategoryList = () =>request({url:"/product/getBaseCategoryList",method:'get'})

export const reqMockbanner = () =>mokeserve.get('/banner')

export const reqMockfloor = () =>mokeserve.get('/floor')

export const searchData = (parms = {}) => {
    return request({url:'/list',method:'post',data:parms})}

export const reqDetail = (value)=>{
    return request.get(`/item/${value}`)
}

export const reqShopping = (value1,value2)=>{
    return request({
        url:`/cart/addToCart/${ value1 }/${ value2 }`,
        method:'post'
    })
}

export const reqListshpping = ()=>{
    return request({
        url:'/cart/cartList',
        method:'get'
        }
    )
}

export const delListShopping = (skuId) =>{
    return request({
        url:`/cart/deleteCart/${skuId}`,
        method:'DELETE'
    })
}

export const checkedList = (skuID,isChecked) =>{
    return request.get(`cart/checkCart/${skuID}/${isChecked}`)
}

export const reqRegister = (phone) =>{
    return request.get(`user/passport/sendCode/${phone}`)
}

export const reqIdentity = (data = {})=>{
    return request({
        url:'user/passport/register',
        method:'post',
        data
    })
}   

export const reqLogin = (data = {})=>{
    return request({
        url:'user/passport/login',
        method:'post',
        data
    })
}

export const reqUserData = ()=>{
    return request({
        url:'user/userAddress/auth/findUserAddressList',
        method:'get'
    })
}

export const reqLogout = ()=>{
    return request({
        url:'user/passport/logout',
        method:'get'
    })
} 

export const reqCommodities = ()=>{
    return request({
        url:'order/auth/trade',
        method:'get'
    })
}

export const reqPay = (tradeNo,data)=>{
    return request({
        url:`order/auth/submitOrder?tradeNo=${tradeNo}`,
        method:'post',
        data
    })
}

export const reqPayOther = (orderId)=>{
    return request({
        url:`payment/weixin/createNative/${orderId}`,
        method:'get'
    })
}

export const reqPayState = (orderId)=>{
    return request({
        url:`payment/weixin/queryPayStatus/${orderId}`,
        method:'get'
    })
}

export const reqMyList = (page,limit)=>{
    return request({
        url:`/order/auth/${page}/${limit}`,
        method:'get'
    })
}